package com.epoint.springboot.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *  springboot加载模版引擎
 * Created by wangchao on 2017/10/28.
 */

@Controller
@RequestMapping("/web")
public class WebController {


    private static final Logger logger= LoggerFactory.getLogger(WebController.class);


    /**
     * freemarker模版加载静态资源  ftl在templates下面
     */
    @RequestMapping("index_ftl")
    public String  index(ModelMap map){
        logger.info("这里是freemarker的controller");
        map.put("title","hello world");
        return "index_freemarker";  // 注意不要加上/,linux下面会出错
    }

    /**
     * thymeleaf模版加载静态资源  html在templates下面
     */
    @RequestMapping("index_th")
    public String  index2(ModelMap map){
        logger.info("这里是thymeleaf的controller");
        map.put("title","hello world");
        return "index_thymeleaf";  // 注意不要加上/,linux下面会出错
    }

    /**
     * 加载jsp
     */
    @RequestMapping("index_jsp")
    public String  index3(ModelMap map){
        logger.info("这里是jsp的controller");
        map.put("title","hello world");
        return "index_jsp";  // 注意不要加上/,linux下面会出错
    }
}
